package ca.uoit.dblp;

public class Util {
	public static long now(String message) {
		if(message != null) System.out.print(message);
		return System.currentTimeMillis(); 
	}
	public static long now() {
		return Util.now(null);
	}
	public static long now(long start) {
		long n = System.currentTimeMillis();
		long ms = n - start;
		p(" done in " + ms + " ms.");
		return n;
	}
	
	public static long mem(String message) {
		if(message != null) System.out.println(message);
		return Runtime.getRuntime().freeMemory();
	}
	public static long mem() {
		return mem(null);
	}
	public static long mem(long m) {
		long x = m - Runtime.getRuntime().freeMemory();
		System.out.println("took " + x + " bytes.");
		return x;
	}
	public static void p(String s) {
		System.out.println(s);
	}
}
